﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ValidationFramework
{
	public class ParameterValidationError
	{
			// --- Constructors

        /// <remarks>
        /// null is an invalid value for any of these parameters. 
        /// Due to performance concerns <see cref="ArgumentNullException"/> will not be thrown.
        /// So just don't pass in null or an empty string.
        /// </remarks>
        /// <param name="rule">The <see cref="Rule"/> that this <see cref="ValidationResult"/> has been generated from.</param>
        /// <param name="errorMessage">The error message.</param>
		/// <param name="attemptedValue">The invalid property's value</param>
		/// <param name="parameterName">The name of the parameter where this <see cref="ParameterValidationError"/> occured.</param>
		/// <param name="methodName">The name of the method who's param generated this <see cref="ParameterValidationError"/>.</param>
		/// <param name="typeName">The name of the type who's method param generated this <see cref="ParameterValidationError"/>.</param>
		public ParameterValidationError(string errorMessage, object attemptedValue, string parameterName, string methodName, string typeName)
        {
            //Dont guard these. the performance hit is not worth the minor help it gives developers. 
            ErrorMessage = errorMessage;
			AttemptedValue = attemptedValue;
			ParameterName = parameterName;
			TypeName = methodName;
        }



		// --- Properties

        /// <summary>
		/// Gets the error message for the <see cref="ParameterValidationError"/>.
        /// </summary>
        public string ErrorMessage
        {
			get;
			private set;
        }

		/// <summary>
		/// Gets the invalid member's value
		/// </summary>
		public object AttemptedValue
		{
			get;
			private set;
		}

        /// <summary>
		/// Gets the name of the parameter that this <see cref="ParameterValidationError"/> was generated for.
        /// </summary>
		public string ParameterName { get; set; }

		/// <summary>
		/// Gets the name of the method who's parameter this <see cref="ParameterValidationError"/> was generated for.
		/// </summary>
		public string MethoName { get; set; }

		/// <summary>
		/// Gets the name of the Type who' method had an invalid parameter.
		/// </summary>
		public string TypeName { get; set; }
	}
}
